<!doctype html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../assert_selection.js"></script>
<script>
test(() => assert_selection(
    [
        'This is a sent|ence number one.',
        'This is a sentence number two.',
    ].join(' '),
    selection => selection.modify('move', 'forward', 'sentenceBoundary'),
    [
        'This is a sentence number one.',
        '|This is a sentence number two.',
    ].join(' ')),
    'move forward sentence boundary from middle of sentence');

test(() => assert_selection(
    [
        '|This is a sentence number one.',
        'This is a sentence number two.',
    ].join(' '),
    selection => selection.modify('move', 'forward', 'sentenceBoundary'),
    [
        'This is a sentence number one.',
        '|This is a sentence number two.',
    ].join(' ')),
    'move forward sentence boundary from start of sentence');

test(() => assert_selection(
    [
        'This is a sentence number one.|',
        'This is a sentence number two.',
    ].join(' '),
    selection => selection.modify('move', 'forward', 'sentenceBoundary'),
    [
        'This is a sentence number one.',
        'This is a sentence number two.|',
    ].join(' ')),
    'move forward sentence boundary from end of sentence');

test(() => assert_selection(
    [
        'This is a sentence number one. | ',
        'This is a sentence number two.',
    ].join(' '),
    selection => selection.modify('move', 'forward', 'sentenceBoundary'),
    [
        'This is a sentence number one.  ',
        'This is a sentence number two.|',
    ].join(' ')),
    'move forward sentence boundary from space');

test(() => assert_selection(
    [
        'This is a sent|ence number one.',
        'This is a sentence number two.',
    ].join(' '),
    selection => selection.modify('move', 'backward', 'sentenceBoundary'),
    [
        '|This is a sentence number one.',
        'This is a sentence number two.',
    ].join(' ')),
    'move backward sentence boundary from middle of sentence');

test(() => assert_selection(
    [
        'This is a sentence number one.',
        '|This is a sentence number two.',
    ].join(' '),
    selection => selection.modify('move', 'backward', 'sentenceBoundary'),
    [
        '|This is a sentence number one.',
        'This is a sentence number two.',
    ].join(' ')),
    'move backward sentence boundary from start of sentence');

test(() => assert_selection(
    [
        'This is a sentence number one.',
        'This is a sentence number two.|',
    ].join(' '),
    selection => selection.modify('move', 'backward', 'sentenceBoundary'),
    [
        'This is a sentence number one.',
        '|This is a sentence number two.',
    ].join(' ')),
    'move backward sentence boundary from end of sentence');

test(() => assert_selection(
    [
        'This is a sentence number one. | ',
        'This is a sentence number two.',
    ].join(' '),
    selection => selection.modify('move', 'backward', 'sentenceBoundary'),
    [
        '|This is a sentence number one.  ',
        'This is a sentence number two.',
    ].join(' ')),
    'move backward sentence boundary from space');
</script>
